Actions for Music Tracks
The following describes the constants you can use as actions for music tracks. For more detailed explanations of how parameters for pitch and velocity are interpreted, see
QuickTime Music Architecture
.
Constant descriptions
-
kActionMusicPlayNote
-
none
Param1: [long sampleDescIndex] Param2: [long partNumber] Param3: [long delay] Param4: [long pitch] Param5: [long velocity] Param6: [long duration]
-
This causes the target music track to play a note. Since the current selection of instruments for a music track is determined by its sample description, you use the
sampleDescIndex
parameter to select which sample description to use. The
partNumber
parameter specifies which part to use within the sample descriptions list. The default is 1.
-
If you want the note to be delayed, you may pass a positive value for the delay parameter, which is interpreted in the time scale of the music track. Pass 0 for no delay. The pitch parameter selects which note to play; for example, Middle C is 60, Middle B is 59. The velocity specifies the volume that the note is played at. The duration specifies the length of time that the note is played for and is interpreted in the time scale of the music track.
-
When using a music track to play notes, you should set the
kMusicFlagDontSlaveToMovie
flag in the MusicDescription's
musicFlags
field. The music track used for playing notes should not contain note information. If you wish to layer notes on top of other music, you should use two separate music tracks.
-
By setting duration to
kNoteEventDurationMax
, the note will continue playing until you send another
kActionMusicPlayNote
for the same pitch with a velocity of 0. This allows you to hold a note for an interactive period of time. For example, on
mouseDown
, you play a note, and on
mouseUp
to turn it off.
-
kActionMusicSetController
-
none
Param1: [long sampleDescIndex] Param2: [long partNumber] Param3: [long delay] Param4: [long controller] Param5: [long value]
-
Sets a controller value for a part in the target music track. Since the current selection of instruments for a music track is determined by its sample description, you use the
sampleDescIndex
parameter to select which sample description to use. The
partNumber
parameter specifies which part to use within the sample descriptions list.
-
If you want the controller change to be delayed, you may pass a positive value for the delay parameter, which is interpreted in the time scale of the music track. Pass 0 for no delay. Controller values control things, such as pitch bend and reverb. For more information about available controllers, see QuickTime Music Architecture.
© 1999 Apple Computer, Inc.| Previous | Chapter Contents | Chapter Top | Next |